#ifndef MagnetometrWindow_H
#define MagnetometrWindow_H

#include <QtGui>
#include <Eigen/Dense>
#include <Eigen/QR>
#include <Eigen/SVD>
#include <Eigen/Cholesky>
#include <Eigen/Core>

#include "structures.h"

using namespace Eigen;

class MagnetometrWindow : public QWidget
{
    Q_OBJECT

public:
    explicit MagnetometrWindow(QWidget *parent = 0);

    void takeMagData(RawMagData magData);

public slots:

signals:
    void collectingEnable(bool);
    void getCurrentMagCalibration();
    void setCurrentMagCalibration(MagnetometrCalibration);
    void flashCommit();

private:
    bool isCollecting;
    QVector<RawMagData> rawMagDataVector;
    MagnetometrCalibration currentMagCalliration;

    QVector<QLineEdit*> rawLEVector;
    QVector<QLineEdit*> matLEVector;
    QVector<QLineEdit*> biasLEVector;
    QPushButton *startCollectBtn;
    QPushButton *computeBtn;
    QPushButton *getCurrentMagCalibrationBtn;
    QPushButton *setCurrentMagCalibrationBtn;
    QPushButton *flashCommitBtn;
    QPushButton *exportBtn;

//    QPushButton *resetBtn;
//    QPushButton *importBtn;

private slots:
    void onStarnCollectBtn();
    void onComputeBtn();

    void onGetCurMagCalibration(MagnetometrCalibration magCal);
    void onConnectEvent(bool bl);
    void sendCurrentMagCalibration(){emit setCurrentMagCalibration(currentMagCalliration);}
    void onExportBtn();

//    void onResetBtn();
//    void onImportBtn();

};

#endif // MagnetometrWindow_H
